using HMCollada.FX;
using System.Xml;
namespace HMCollada.FX {
    internal struct HMColladaSetParam {
        internal string reference;
        internal HMColladaValueType VALUE_TYPE;
    }
}

namespace HMCollada {
    internal partial class HMColladaLoader {
        private static HMColladaSetParam LoadSetParam() {
            HMColladaSetParam setParam = new HMColladaSetParam();
            setParam.reference = colladaReader.GetAttribute("ref");

            if (!colladaReader.IsEmptyElement) colladaReader.Read();
            do {
                if (colladaReader.NodeType != XmlNodeType.EndElement) {
                    switch (colladaReader.Name) {
                        case "bool": setParam.VALUE_TYPE = new HMColladaBool(ReadBool()); break;
                        case "bool2": setParam.VALUE_TYPE = new HMColladaBool2(ReadBool(2)); break;
                        case "bool3": setParam.VALUE_TYPE = new HMColladaBool3(ReadBool(3)); break;
                        case "bool4": setParam.VALUE_TYPE = new HMColladaBool4(ReadBool(4)); break;
                        case "float": setParam.VALUE_TYPE = new HMColladaFloat(ReadFloat()); break;
                        case "float2": setParam.VALUE_TYPE = new HMColladaFloat2(ReadFloat(2)); break;
                        case "float3": setParam.VALUE_TYPE = new HMColladaFloat3(ReadFloat(3)); break;
                        case "float4": setParam.VALUE_TYPE = new HMColladaFloat4(ReadFloat(4)); break;
                        case "float1x1": setParam.VALUE_TYPE = new HMColladaFloat1x1(ReadFloat(1, 1)); break;
                        case "float1x2": setParam.VALUE_TYPE = new HMColladaFloat1x2(ReadFloat(1, 2)); break;
                        case "float1x3": setParam.VALUE_TYPE = new HMColladaFloat1x3(ReadFloat(1, 3)); break;
                        case "float1x4": setParam.VALUE_TYPE = new HMColladaFloat1x4(ReadFloat(1, 4)); break;
                        case "float2x1": setParam.VALUE_TYPE = new HMColladaFloat2x1(ReadFloat(2, 1)); break;
                        case "float2x2": setParam.VALUE_TYPE = new HMColladaFloat2x2(ReadFloat(2, 2)); break;
                        case "float2x3": setParam.VALUE_TYPE = new HMColladaFloat2x3(ReadFloat(2, 3)); break;
                        case "float2x4": setParam.VALUE_TYPE = new HMColladaFloat2x4(ReadFloat(2, 4)); break;
                        case "float3x1": setParam.VALUE_TYPE = new HMColladaFloat3x1(ReadFloat(3, 1)); break;
                        case "float3x2": setParam.VALUE_TYPE = new HMColladaFloat3x2(ReadFloat(3, 2)); break;
                        case "float3x3": setParam.VALUE_TYPE = new HMColladaFloat3x3(ReadFloat(3, 3)); break;
                        case "float3x4": setParam.VALUE_TYPE = new HMColladaFloat3x4(ReadFloat(3, 4)); break;
                        case "float4x1": setParam.VALUE_TYPE = new HMColladaFloat4x1(ReadFloat(4, 1)); break;
                        case "float4x2": setParam.VALUE_TYPE = new HMColladaFloat4x2(ReadFloat(4, 2)); break;
                        case "float4x3": setParam.VALUE_TYPE = new HMColladaFloat4x3(ReadFloat(4, 3)); break;
                        case "float4x4": setParam.VALUE_TYPE = new HMColladaFloat4x4(ReadFloat(4, 4)); break;
                    }
                }

                if (!colladaReader.IsEmptyElement) colladaReader.Read();
            } while (colladaReader.Name != "setparam");

            if (colladaReader.IsEmptyElement) colladaReader.Read();
            return setParam;
        }
    }
}